package com.hellobike.haxing.modules.purchase.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hellobike.haxing.modules.purchase.entity.TPurchaseOrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @Description: t_purchase_order_detail
 * @Author: haxing-boot
 * @Date:   2020-02-12
 * @Version: V1.0
 */
public interface TPurchaseOrderDetailMapper extends BaseMapper<TPurchaseOrderDetail> {

    @Update("UPDATE t_purchase_order_detail SET supply_volume=#{supplyVolume} " +
            "where \"sku_id\" = #{skuId} " +
            "and parent_order_code in ( " +
            "SELECT order_code FROM t_purchase_order " +
            "WHERE \"state\" < 3 " +
            ")")
    void updateBySkuIdAndSupplier(@Param("skuId") Long skuId,@Param("supplyVolume") Integer supplyVolume);
}
